package edu.yuhf.tts.cui;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import edu.yuhf.dbutil.JdbcTemplate;
import edu.yuhf.tts.domain.User;

public class LoginCUI {
			JdbcTemplate jt=new JdbcTemplate();
			
			public User Login(String name,String password) {
				String sql="select * from tts_userinfo where name=? and password=?";
				
				User user=jt.query(sql,(rs)->{
					User user0=null;
					try {
						while(rs.next()) {
						User user1=new User(rs.getInt(1),rs.getString(2),rs.getString(3),rs.getString(4),rs.getString(5),rs.getString(6));
						user0=user1;
						}
						
					} catch (SQLException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
					return user0;
				}, name,password);
				
				return user;
			}
}
